#include<iostream>
#include<unistd.h>
#include<cstdlib>
using namespace std;
int main()
{
  pid_t id=fork();
  if(id==0)
  {
    //子进程
    while(1)
    {
      printf("我是子进程,pid:%d\n",getpid());
      sleep(1);
    }
  }
  else if(id>0)
  {
    int count=10;
    while(count--)
    {
      printf("我是父进程，pid:%d\n",getpid());
      sleep(1);
    }
  }
  return 0;
}
